package com.mt.restaurant.entity.material;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

import com.mt.common.core.annotation.DColumn;
import com.mt.common.core.annotation.DEntity;
import com.mt.common.core.web.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;



import com.mt.restaurant.entity.sale.Address;

@DEntity(label="供应商",comment="",moduleLabel="原材料管理")
@Entity(name="restaurant_supplier")
@Table(name = "restaurant_supplier" , indexes = { @Index(name = "index_contact_address_id", columnList = "contact_address_id")  })
@ApiModel(description = "供应商:")
public class Supplier extends BaseEntity implements Serializable{
	private static final long serialVersionUID = 1L;

	@DColumn(index=3,label="联系电话",comment="联系电话",component="文本",where=false)
	@ApiModelProperty(value = "联系电话:联系电话")
	@Column(name="contact_tel",length=255,nullable=true,unique=false)
	private String contactTel;

	@DColumn(index=4,label="电子邮箱",comment="电子邮箱",component="文本",where=false)
	@ApiModelProperty(value = "电子邮箱:电子邮箱")
	@Column(name="email",length=255,nullable=true,unique=false)
	private String email;

	@DColumn(index=5,label="联系地址",foreignEntity="Address",comment="联系地址",component="对象选择",where=false)
	@ApiModelProperty(value = "联系地址:联系地址")
	@Column(name="contact_address_id",length=255,nullable=true,unique=false)
	private Long contactAddressId;

	@Transient
	private Address contactAddress;

	@Transient
	@ApiModelProperty(value = "联系地址名称:联系地址")
	@DColumn(index=5,label="联系地址",foreignEntity="Address",comment="联系地址")
	private String contactAddressName;

	@DColumn(index=6,label="采购员",comment="使用Staff表里的采购员",component="数字，整数",where=false)
	@ApiModelProperty(value = "采购员:使用Staff表里的采购员")
	@Column(name="purchaser",length=255,nullable=true,unique=false)
	private Long purchaser;

	@Transient
	private String purchaserName;

	@Transient
	private List<SupplyMaterial> supplyMaterialList;


	public String getContactTel() {
		return this.contactTel;
	}

	public void setContactTel(String contactTel) {
		this.contactTel = contactTel;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Long getContactAddressId() {
		return this.contactAddressId;
	}

	public void setContactAddressId(Long contactAddressId) {
		this.contactAddressId = contactAddressId;
	}

	public Long getPurchaser() {
		return this.purchaser;
	}

	public void setPurchaser(Long purchaser) {
		this.purchaser = purchaser;
	}

	public Address getContactAddress() {
		return this.contactAddress;
	}

	public void setContactAddress(Address contactAddress) {
		if(contactAddress == null){
		}
		else
		{
		this.contactAddressId = contactAddress.getEid();
		this.contactAddress = contactAddress;		
		}
}

	public String getContactAddressName() {
		return this.contactAddressName;
	}

	public void setContactAddressName(String contactAddressName) {
		this.contactAddressName = contactAddressName;
	}


	public String getPurchaserName() {
		return purchaserName;
	}

	public void setPurchaserName(String purchaserName) {
		this.purchaserName = purchaserName;
	}

	public List<SupplyMaterial> getSupplyMaterialList() {
		return supplyMaterialList;
	}

	public void setSupplyMaterialList(List<SupplyMaterial> supplyMaterialList) {
		this.supplyMaterialList = supplyMaterialList;
	}
}
